<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Followers</title>
</head>
<body>

<a href="./HomeController">Home</a> <br/>
<a href="./LogoutController">Log out</a> <br/>



<c:if test="${ empty user }">
<!--  redirect na home -->
</c:if>

<c:if test="${ not empty sessionScope.user }">
	<h1> Followers </h1>
	<ul>
		<c:forEach items="${ sessionScope.user.followers }" var="follower">
			
			<li> <a href="./ViewUserController?id=${ follower.id }"><c:out value="${ follower.firstname }"/>  <c:out value="${ follower.lastname }"/></a></li>	
	
		</c:forEach>
	</ul>
	
	
	<h1> Followed users </h1>
	<ul>
		<c:forEach items="${ sessionScope.user.followedUsers }" var="followed">
		
			<li> <a href="./ViewUserController?id=${ followed.id }"><c:out value="${ followed.firstname }"/>  <c:out value="${ followed.lastname }"/></a></li>		
		
		</c:forEach>
	</ul>
</c:if>


</body>
</html>